#!/usr/bin/python
import os
import os.path
import sys
import datetime
import sendmail
from config import * 
today = datetime.date.today()
PROGDIR = os.path.dirname(sys.argv[0])
for name in FEEDS:
	feed = FEEDS[name]
	os.system("wget -q -T 5 -O %s/%s.xml \"%s\"" % (RUNDIR,name,feed))
	os.system("xsltproc %s/rss.xsl %s/%s.xml > %s/%s.html" % (PROGDIR,RUNDIR,name,RUNDIR,name))
	sendmail.send("%s-%s.html" % (name,today), "%s/%s.html" % (RUNDIR,name))
	#os.system("rm -rf %s/*" % RUNDIR);

